import {post,get} from './axios'

//发送短信验证码
export function sendSmsCode(params:string) {
    return new Promise((resolve, reject) => {
        post('/msg/shortMsg/sendSmsCode',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//用户消息数
export function userMsgCount() {
    return new Promise((resolve, reject) => {
        get('/msg/msg/userMsgCount',{noLoading:true}).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//查看消息
export function msgQueryDetail(id: string) {
    return new Promise((resolve, reject) => {
        get('/msg/msg/queryDetail/' + id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//报警消息 用户消息数
export function msgQueryPage(params: {}) {
    return new Promise((resolve, reject) => {
        post('/msg/msg/queryPage', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//未处理报警数
export function alarmRecordCountNoSolve() {
    return new Promise((resolve, reject) => {
        get('/msg/alarmRecord/countNoSolve').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//报警记录列表
export function alarmRecordQueryPage(params:object) {
    return new Promise((resolve, reject) => {
        post('/msg/alarmRecord/queryPage',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//报警处理
export function alarmRecordSolve(params:object) {
    return new Promise((resolve, reject) => {
        post('/msg/alarmRecord/solve',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//报警记录详情
export function alarmRecordDetail(id:string) {
    return new Promise((resolve, reject) => {
        post('/msg/alarmRecord/queryDetail/'+id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//获取报警类型树形数据
export function getAlarmTypeList() {
    return new Promise((resolve, reject) => {
        get('/msg/alarmType/getTreeData',{noLoading:true}).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//平台通知列表
export function noticePlatformQueryPage(params:object) {
    return new Promise((resolve, reject) => {
        post('/msg/noticePlatform/queryPage',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}
//发送平台通知
export function noticePlatformAdd(params:object) {
    return new Promise((resolve, reject) => {
        post('/msg/noticePlatform/add',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}
//平台通知删除
export function noticePlatformDel(params:object) {
    return new Promise((resolve, reject) => {
        post('/msg/noticePlatform/del',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}
//平台通知详情
export function noticePlatformDetail(id:string) {
    return new Promise((resolve, reject) => {
        get('/msg/noticePlatform/detail/'+id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//报警规则删除
export function delAlarmRule(params: {}) {
    return new Promise((resolve, reject) => {
        post('/msg/alarmRule/delAlarmRule', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//报警规则列表
export function queryAlarmRule(params: {}) {
    return new Promise((resolve, reject) => {
        post('/msg/alarmRule/queryAlarmRule', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//报警规则详情
export function getAlarmRuleDetail(id: any) {
    return new Promise((resolve, reject) => {
        get('/msg/alarmRule/queryAlarmRuleDetail/'+id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//报警规则新增
export function addAlarmRule(params: {}) {
    return new Promise((resolve, reject) => {
        post('/msg/alarmRule/addAlarmRule', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//报警规则修改
export function editAlarmRule(params: {}) {
    return new Promise((resolve, reject) => {
        post('/msg/alarmRule/editAlarmRule', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//消息通知-全部已读
export function msgAllRead(params:object) {
    return new Promise((resolve, reject) => {
        post('/msg/msg/allRead',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}
//报警批量处理
export function solveBatch(params: []) {
    return new Promise((resolve, reject) => {
        post('/msg/alarmRecord/solveBatch', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}
